package com.song.su.controller;

import com.song.su.mapper.AdminMapper;
import com.song.su.model.AdminUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class AdminLoginController {

    @Autowired
    AdminMapper adminMapper;

    @GetMapping("/admin_login123x")
    public String adminLogin(){


        return "admin_login123x";
    }
    @PostMapping("/admin_login123x")
    public String postAdmi(@RequestParam(name = "username") String username,
                           @RequestParam(name = "password") String password){
        if (adminMapper.findByPasswd(username, password)!=null)
        {
            return "redirect:/admin";
        }
        else
            return "admin_login123x";

    }
}
